/**
 * @description 在这里对个人信息进行操作的记录
 * */
interface UserStore {
  token: string;
  expires_in: number;
}

export const useUserStore = defineStore('user', () => {
  const state = reactive<UserStore>({
    token: '',
    expires_in: null as unknown as number,
  });

  const setToken = ({
    access_token,
    expires_in,
  }: {
    access_token: string;
    expires_in?: number;
  }) => {
    state.token = access_token;
    if (expires_in) {
      state.expires_in = expires_in;
    }
  };

  return {
    state,
    setToken,
  };
});
